package com.market.plus.core.domain;

import com.market.plus.core.exception.ExceptionCode;
import com.market.plus.core.exception.TypeCodeException;
import com.market.plus.core.exception.UnsupportTypeException;

public enum NewsSecurityType {
   PUBLIC(0), ALLFRIENDS(1), CUSTOM(2);

   private int newsSecurityType;


   public int getNewsSecurityType() {
      return newsSecurityType;
   }

   private NewsSecurityType(int newsSecurityType) {
      this.newsSecurityType = newsSecurityType;
   }

   public static NewsSecurityType getNewsType(int newsType) throws UnsupportTypeException {
      NewsSecurityType value = null;
      switch (newsType) {
      case 0:
         value = PUBLIC;
         break;
      case 1:
         value = ALLFRIENDS;
         break;
      case 2:
         value = CUSTOM;
         break;
      default:
    	 throw new UnsupportTypeException(ExceptionCode.instance(TypeCodeException.class, TypeCodeException.NEWSTYPE));
      }
      return value;
   }
}
